const regList = {
  mobile: /^1\d{10}$/,
  code: /^\d{6}$/,
  passwd: /^\S{6,20}$/,
  numPasswd: /^\d{6}$/,
  rechargeCard: /^\d{12}$/,
  couponCard: /^\d{16}$/,
  card16: /^\d{16}$/,
  card12: /^\d{12}$/,
  oilCard: /^\d{19}$/,
  email: /^(\w)+(\.\w+)*@(\w)+((\.\w+)+)$/,
  company: /^.+$/,
  taxCode: /^.+$/,
  address: /^.{1,100}$/,
  name: /^.{1,50}$/,
  pinganId: /^\d{7}$/,
  // carNo: /^.{7}$/,
  carNo: /^([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[a-zA-Z](([DF]((?![IO])[a-zA-Z0-9](?![IO]))[0-9]{4})|([0-9]{5}[DF]))|[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1})$/,
};

export function is(target, value) {
  const reg = regList[target];
  if (!reg) {
    throw new Error(target, '正则表达式不存在，请检查validataor.js');
  }
  return regList[target].test(value);
}

export function not(target, value) {
  return !is(target, value);
}
